<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>试题详情</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/common/plugin/jquery.min.js"></script>
<script type="text/javascript" src = "<%=request.getContextPath() %>/static/teach/js/record-list.js"></script>
</head>
<body>
<center><h1>试题详情</h1></center>
		<hr>
		<c:forEach items="${questionList }" var="list" varStatus="v">
		<form action="<%=request.getContextPath()%>/teach/testquestion/QuestionServlet?command=updateInfo&id=${list.id}" method="post" onsubmit="return validates();">
                         题　　目:<input type="text" name="question" onkeyup="checkLength(this)" value="${list.question }" id="question" /><br><br>  
                         附　　件:<input type="text" name="attachment" value="${list.attachment }" id="attachment" /><br><br>               
                         题　　型:
              <c:set var="question_type" value="${list.question_type }" ></c:set>  
	          <c:if test="${question_type == 1}">
	            <input type="radio" name="question_type" value="1" checked="checked" id="dan"/>单选
	            <input type="radio" name="question_type" value="2" id="duo" />多选
	            <input type="radio" name="question_type" value="3" id="pan" />判断 <br><br>
	          </c:if>
	          <c:if test="${question_type == 2}">
	            <input type="radio" name="question_type" value="1" id="dan" />单选
	            <input type="radio" name="question_type" value="2" id="duo" checked="checked"/>多选
	            <input type="radio" name="question_type" value="3" id="pan" />判断 <br><br>
	          </c:if>
	          <c:if test="${question_type == 3}">
	            <input type="radio" name="question_type" value="1" id="dan" />单选
	            <input type="radio" name="question_type" value="2" id="duo" />多选
	            <input type="radio" name="question_type" value="3" checked="checked" id="pan"/>判断 <br><br>
	          </c:if>
	                所属课程:<select name="courseName"> 
				<option value="全部课程">—全部课程—</option>
                <c:forEach items="${nameList }" var="nameList" >               
				<option  value="${list.courseName  }" >${nameList.courseName}</option>
				<span id="courseName"></span>
			</c:forEach>  
			</select><br><br>
	     <div id="choiceAnswer">
	             选 项 A :<input type="text" name="answer_a" id="answer_a"  value="${list.answer_a }"/>
	             选 项 B :<input type="text" name="answer_b" id="answer_b"  value="${list.answer_b }"/>
	             选 项 C :<input type="text" name="answer_c" id="answer_c"  value="${list.answer_c }"/>
	             选 项 D :<input type="text" name="answer_d" id="answer_d"  value="${list.answer_d }"/>
	     </div><br>
	                答　　案:<input type="text" name="answer" value="${list.answer }" id="answer" /><br><br>
	                难　　度:
	          <c:set var="difficulty" value="${list.difficulty }"></c:set>  
	          <c:if test="${difficulty == 1}">
	            <input type="radio" name="difficulty" value="1" checked="checked" />低
	            <input type="radio" name="difficulty" value="2"/>中
	            <input type="radio" name="difficulty" value="3"/>较高
	            <input type="radio" name="difficulty" value="4"/>高 <br><br>
	          </c:if>
	          <c:if test="${difficulty == 2}">
	            <input type="radio" name="difficulty" value="1"/>低
	            <input type="radio" name="difficulty" value="2"  checked="checked" />中
	            <input type="radio" name="difficulty" value="3"/>较高
	            <input type="radio" name="difficulty" value="4"/>高 <br><br>
	          </c:if>
	          <c:if test="${difficulty == 3}">
	            <input type="radio" name="difficulty" value="1"/>低
	            <input type="radio" name="difficulty" value="2"/>中
	            <input type="radio" name="difficulty" value="3"  checked="checked" />较高
	            <input type="radio" name="difficulty" value="4"/>高 <br><br>
	          </c:if>
	          <c:if test="${difficulty == 4}">
	            <input type="radio" name="difficulty" value="1"/>低
	            <input type="radio" name="difficulty" value="2"/>中
	            <input type="radio" name="difficulty" value="3"/>较高
	            <input type="radio" name="difficulty" value="4"  checked="checked" />高 <br><br>
	          </c:if>
	                分　　析:<input type="text" name="analysis" value="${list.analysis }" id="analysis" /><br><br>
	                关  键  词:<input type="text" name="keywords" value="${list.keywords }" id="keywords" /><br><br>
                          操  作  者:<input type="text" name="userName" value="${list.userName }" id="userName" disabled="disabled" /><br><br>              
                          操作时间:<input type="text" name="operate_time" value="${list.operate_time }" id="operate_time" disabled="disabled" /><br><br>             
                          状　　态:
              <c:set var="state" value="${list.state }"></c:set>  
	          <c:if test="${state == 1}">
	            <input type="radio" name="state" value="1" checked="checked" />启用<input type="radio" name="state" value="2"/>禁止<span id="stateInfo"></span> <br><br>
	          </c:if>
	          <c:if test="${state == 2}">
	            <input type="radio" name="state" value="1"/>启用<input type="radio" name="state" value="2" checked="checked" />禁止<span id="stateInfo"></span> <br><br>
	          </c:if>               
                          备　　注:<input type="text" name="memo" value="${list.memo }"  id="memo"/><span id="memoInfo"></span> <br><br><br>
　　　    <input type="submit" value="修改" onclick="return confirm('是否修改？');">
		</form>
</c:forEach>

<script language="javascript">
function checkLength(which) {
    var oTextCount = document.getElementById("char");   
    iCount = which.value.replace(/[^\u0000-\u00ff]/g,"aa");
    which.style.border = '1px dotted #FF0000';
	which.size=iCount.length+2;
}
$("#choiceAnswer").hide(); // 先隐藏
$("#dan").click(function() {
    $("#choiceAnswer").show(); // 然后显示对应的选项
});
$("#duo").click(function() {
    $("#choiceAnswer").show(); // 然后显示对应的选项
});
$("#pan").click(function() {
    $("#choiceAnswer").hide(); // 隐藏选项
});
 </script>
</body>
</html>